//
//  RootViewController.m
//  项目三
//
//  Created by rimi1 on 2016/12/9.
//  Copyright © 2016年 Wangxingqian. All rights reserved.
//

#import "RootViewController.h"
#import "HomeViewController.h"
#import "PublicViewController.h"
#import "CoilViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self initializeAppearance];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

- (void)initializeAppearance {
    HomeViewController *home = [[HomeViewController alloc] init];
    PublicViewController *public = [[PublicViewController alloc] init];
    CoilViewController *coil = [[CoilViewController alloc] init];
    
    NSArray <BaseViewController *> *viewControllers = @[home, public, coil];
    NSArray *name = @[@"推荐", @"美食广场", @"美食圈"];
    NSMutableArray <UINavigationController *> *navigations = [NSMutableArray array];
    
    for (int i = 0; i < viewControllers.count; i++) {
        UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:viewControllers[i]];
        nc.tabBarItem.image = [UIImage imageNamed:name[i]];
        nc.tabBarItem.title = name[i];
        [nc setNavigationBarHidden:YES];
        
        [navigations addObject:nc];
    }
    
    self.tabBar.translucent = NO;
    self.viewControllers = navigations;
    self.selectedIndex = 1;
}

@end











